<!DOCTYPE html>
<html lang="zh-CN">
<head>
  <meta charset="UTF-8">
  <meta name="viewport" content="width=device-width,user-scalable=no,initial-scale=1.0,maximum-scale=1.0,minimum-scale=1.0">
  <meta http-equiv="pragma" content="no-cache">
  <meta http-equiv="cache-control" content="no-cache">
  <meta http-equiv="expires" content="0">
  <title>新闻</title>
  <link rel="shortcut icon" href="/favicon.ico"/>
  <link rel="bookmark" href="/favicon.ico"/>
  <link rel="stylesheet" href="/webjars/layui/css/layui.css">
  <link rel="stylesheet" href="/css/portal/index.css">
  <link rel="stylesheet" href="/css/portal/exlayout.css">
</head>
<body>
  <!-- nav部分 -->
  <div class="nav index">
    <div class="layui-container">
      <!-- 公司logo -->
      <div class="nav-logo">
        <a href="/">
          <img src="/img/portal/logo.png" alt="公司名称">
        </a>
      </div>
      <em class="layui-icon layui-icon-app mobile-icon"></em>
      <div class="nav-list">
        <ul class="layui-nav" lay-filter="">
          <li class="layui-nav-item"><a href="/">首页</a></li>
          <li class="layui-nav-item layui-this"><a href="/html/news.html">新闻</a></li>
          <li class="layui-nav-item"><a href="/html/service.html">服务项目</a></li>
          <li class="layui-nav-item"><a href="/html/tech.html">技术成果</a></li>
          <li class="layui-nav-item"><a href="/html/about.html">联系我们</a></li>
        </ul>
      </div>
    </div>
  </div>
  <!-- banner部分 -->
  <div class="banner news">
    <div class="title">
      <p>新闻资讯</p>
      <p class="en">News Information</p>
    </div>
  </div>
  <!-- main -->
  <div class="main product">
    <div class="layui-container">
      <ul id="LAY_demo2">
      </ul>
    </div>
  </div>
  <!-- footer部分 -->
  <div class="footer">
    <div class="layui-container">
      <p class="footer-web">
        <a href="javascript:;">合作伙伴1</a>
        <a href="javascript:;">合作伙伴2</a>
        <a href="javascript:;">合作伙伴3</a>
        <a href="javascript:;">合作伙伴4</a>
        <a href="javascript:;">合作伙伴5</a>
        <a href="javascript:;">合作伙伴6</a>
      </p>
      <div class="layui-row footer-contact">
        <div class="layui-col-sm2 layui-col-lg1" id="qrcode"></div>
        <div class="layui-col-sm10 layui-col-lg11">
          <div class="layui-row">
            <div class="layui-col-sm6 layui-col-md8 layui-col-lg9">
              <p class="contact-top"><em class="layui-icon layui-icon-cellphone"></em>&nbsp;电话号码&nbsp;&nbsp;&nbsp;(时间段)</p>
              <p class="contact-bottom"><em class="layui-icon layui-icon-home"></em>&nbsp;邮箱地址</span></p>
            </div>
            <div class="layui-col-sm6 layui-col-md4 layui-col-lg3">
              <p class="contact-top"><span class="right">公司地址</span></p>
              <p class="contact-bottom"><span class="right">&nbsp;&copy;&nbsp;版权时间段&nbsp;&nbsp;备案号</span></p>
            </div>
          </div>
        </div>
      </div>
    </div>
  </div>
<script src="/webjars/jquery/jquery.min.js"></script>
<script src="/webjars/layui/layui.js"></script>
<script src="/js/portal/qrcode.min.js"></script>
<script src="/js/portal/common.js"></script>
<script>
  layui.config({
    base: '/js/portal/' 
  }).use('firm');

  layui.use('flow', function() {
      var flow = layui.flow;
      flow.load({
          elem: '#LAY_demo2' //流加载容器
          ,scrollElem: '#LAY_demo2' //滚动条所在元素，一般不用填，此处只是演示需要。
          ,isAuto: false
          ,isLazyimg: true
          ,done: function(page, next){ //加载下一页
              try {
                  queryWriting(page,4,next);
              }catch(err) {
                  next(null,false);
              }

          }
      });

  });

  function queryWriting(page,limit,next) {
      $.ajax({
          url:'/web/queryWriting',
          async:true,
          data:{page:page,limit:limit,type:'NEWS'},
          dataType:'json',
          type:'GET',
          success:function(xhrdata) {
              var totalPages = xhrdata.totalpages;
              var pageData = xhrdata.data;
              var lis = [];
              for(var i = 0; i < pageData.length; i++){
                  var imageurl = pageData[i].imgUrl;
                  if(!imageurl) {
                      imageurl = "/upload/image/none.jpg";
                  }
                  var htmlstr = '<li><div class="content layui-row">' +
                      '<div class="layui-col-xs12 layui-col-sm6 layui-col-md7 layui-col-lg6 content-img">' +
                      '<img src="..'+imageurl+'" style="width: 360px;height: 260.4px;margin-left: 20%;"></div>' +
                      '<div class="layui-col-xs12 layui-col-sm6 layui-col-md5 layui-col-lg6 right">' +
                      '<p class="label">'+pageData[i].title+'</p><p class="detail">' +
                      pageData[i].comments+
                      '</p><div><a href="#" onclick="detail('+pageData[i].id+')">查看详情 ></a></div></div></div></li>';
                  lis.push(htmlstr);
              }
              next(lis.join(''), page < totalPages); //page小于总页数时出现“加载更多”按钮
          },
          error:function(errodata) {
//              console.log(errodata.responseText.message);
              throw new Error(errodata.responseText.message);
          }
      });
  }


  function detail(id) {
      window.open("newsDetail.html?id="+id,"_blank");
  }
</script>
</body>
</html>